T
Chili.Opf3 Send comments on this topic.
Generic GetObject(ICustomPersister,String,Object[]) Method
See Also  Example
Chili.Opf3 Namespace > ObjectContext Class > GetObject Method : Generic GetObject(ICustomPersister,String,Object[]) Method




customPersister
The class implementing the ICustomPersister interface.
conditions
A condition string that specifies the object that is loaded.
parameters
A list of parameter that is passed as parameter for the conditions.
Populates a class implementing the ICustomPersister interface with data.

Syntax

Visual Basic (Declaration) 
Overloads Public Overridable Function GetObject(Of T)( _
   ByVal customPersister As ICustomPersister, _
   ByVal conditions As String, _
   ByVal ParamArray parameters() As Object _
) As ICustomPersister
Visual Basic (Usage)Copy Code
Dim instance As ObjectContext
Dim customPersister As ICustomPersister
Dim conditions As String
Dim parameters() As Object
Dim value As ICustomPersister
 
value = instance.GetObject(Of T)(customPersister, conditions, parameters)
C# 
public virtual ICustomPersister GetObject<T>( 
   ICustomPersister customPersister,
   string conditions,
   params object[] parameters
)
Managed Extensions for C++ 
public: virtual ICustomPersister* GetObject<T>( 
   ICustomPersister* customPersister,
   string* conditions,
   params Object*[]* parameters
) 
C++/CLI 
public:
virtual ICustomPersister^ GetObjectgeneric<typename T>
( 
   ICustomPersister^ customPersister,
   String^ conditions,
   ... array<Object^>^ parameters
) 

Parameters

customPersister
The class implementing the ICustomPersister interface.
conditions
A condition string that specifies the object that is loaded.
parameters
A list of parameter that is passed as parameter for the conditions.

Type Parameters

T

Return Value

The first object implementing the ICustomPersister interface.

Example

The following example introduces to the use of the GetObject routine with the ICustomPersister interface.
C#Copy Code
// Creates a new ObjectContext that uses an MsSql Server as storage. 
ObjectContext context = new ObjectContext(new MsSqlStorage("sa", "",  
    "localhost", "application")); 
  
// ... Other code. 
  
// Populates the given ObjectSet with data. 
ObjectSet<User> = context.GetObject<User>(new ObjectSet<User>(),  
    "Name like {0} SortBy Name Asc", "%mith%"); 
    

Remarks

Populates the class implementing the ICustomPersister with data from the storage. The class gets the control on how to load the objects from the storage. A query is also given to have the object loaded the objects matching the query. There is no guarantuee that the object loads exactly the objects returned by the query, since it controls the loading process by itself.

Requirements

Platforms: Windows 2000, Windows XP family, Windows Server 2003 family, Windows Vista family

See Also